feat: replace assets state references confirmations#29726
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
| state.engine?.backgroundState?.AccountTrackerController?.accountsByChainId; | ||
| const accountsByChainId = selectAccountsByChainId(state); | ||
|
|
||
| const account = accountsByChainId?.[chainId]?.[address?.toLowerCase()]; |
There was a problem hiding this comment.
This was broken. In the current state, the addresses in accountsByChainId are stored in checksum format.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 325394d. Configure here.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Why no E2E tags are needed:
Why no performance tests are needed:
Performance Test Selection: |
|




Description
The new
AssetsControlleris being introduced to replace most controllers from@metamask/assets-controllers. This is one of many PRs that replace direct access to legacy state with selectors that, using a feature flag, handle the transition between the legacy state and the new state when the flag is turned on.Changelog
CHANGELOG entry: null
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-2827
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Medium Risk
Updates how native balances are looked up for
gas_insufficient_native_asset, which could change metrics output if address casing/normalization differs across callers. Scoped to analytics/metrics code with test adjustments, but affects transaction-finalized event properties.Overview
Updates gas metrics to read account balances via the
selectAccountsByChainIdselector instead of directly accessingAccountTrackerControllerstate, aligning with the ongoing assets-state migration.getNativeBalancenow resolves the sender address withsafeToChecksumAddressand looks up balances by checksummed key (removing the previous.toLowerCase()access). Tests were updated to use a realistic checksummed address and store balances under that exact key.Reviewed by Cursor Bugbot for commit f71e6c6. Bugbot is set up for automated code reviews on this repo. Configure here.